home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PINBSRC.ZIP / FLIPPERM.PAS < prev    next >
Pascal/Delphi Source File  |  1996-02-02  |  6KB  |  262 lines

  1. { FLIPPERM.PAS   - (c) Ansgar Scherp, Joachim Gelhaus
  2.   All right reserved / vt'95
  3.  
  4.   MAIN MENU
  5.  
  6.   }
  7.  
  8. program FLIPPER_MAIN_MENU;
  9. uses dos,crt;
  10. const N1 = ' PCS-PINBALL  - Version 1.1 written by A.Scherp and J.Gelhaus ';
  11.       N2 = ' (c)opyrights reserved by PC Spiel and vIRTUAL tECHNOLOGIES GbR';
  12.  
  13. const rahmen1:byte = 35;
  14.       rahmen2:byte = 36;
  15.       menucolor  :array[1..6] of byte=(95,96,97,98,99,100);
  16.       playercolor:array[1..6] of byte=(101,102,103,104,105,106);
  17.       Kreuz      :array[1..3] of byte=(35,36,107);
  18.  
  19. var auswahl:byte;
  20.     ch:byte;
  21.     ende:boolean;
  22.     auswahlcolor,auswahlrichtung:byte;
  23.     tables,highres,overscan,music:byte;
  24.     minis:array[1..2] of pointer;
  25.     miniseg:array[1..2] of word;
  26.     I:word;
  27.     player:byte;
  28.     path:string;
  29.     hilfsb:byte;
  30.     params:string;
  31.     code:integer;
  32. {$I _NORMVGA.PAS}
  33.  
  34. procedure SET_PAL0;
  35. begin
  36.   port[$3c8] := 0;
  37.   port[$3c9]:=pal[0,1]; port[$3c9]:=pal[0,2]; port[$3c9]:=pal[0,3];
  38. end;
  39.  
  40. procedure decode_paras;
  41. var i:byte;
  42. begin
  43.   val(params,i,code);
  44.   if I and 64 = 64 then tables:=2   else tables:=1;
  45.   if i and 32 = 32 then music:=1    else music:=0;
  46.   if i and 16 = 16 then highres:=1  else highres:=0;
  47.   if i and  8 =  8 then overscan:=1 else overscan:=0;
  48.   player:=i and 7;
  49. end;
  50.  
  51. procedure DISPLAY_ANSI;
  52. var f:file;
  53.     buffer:array[1..4000] of byte;
  54.     b:byte;
  55.     z:word;
  56.     mfm:word;
  57. begin
  58.   mfm:=filemode;
  59.   filemode:=0;
  60.   assign(f,'menu\menu.end');
  61.   reset(f,1);
  62.   blockread(f,buffer,4000,z);
  63.   close(f);
  64.   filemode:=mfm;
  65.   for z:=1 to 4000 do mem[$b800:z-1]:=buffer[z];
  66. end;
  67.  
  68. function IntToStr(I: Longint): String;
  69. var
  70.   Stri: string[11];
  71. begin
  72.   Str(I, Stri);
  73.   IntToStr := Stri;
  74. end;
  75.  
  76. procedure Go_out_of_here;
  77. begin
  78.   for i:=1 to 2 do FreeMem(minis[i], 82*151);
  79.   video_mode(3);
  80. {STANDART-DOS-FONT}
  81.  (* asm
  82.   push ax
  83.   push es
  84.   push bp
  85.   {}
  86.   mov ax,1130h; mov bh,1; int 10h; {mov Fseg,es; mov Fofs,bp;}
  87.   push es
  88.   push bp
  89.   {}
  90.   mov ax,1100h
  91.   mov bx,1000h
  92.   mov cx,0100h
  93.   mov dx,0000h
  94.   pop es
  95.   pop bp
  96.   lea bp,[es:bp]
  97.   int 10h
  98.   {}
  99.   pop bp
  100.   pop es
  101.   pop ax
  102.   end;*)
  103.   Display_ansi;
  104.   gotoxy(1,16);
  105. end;
  106.  
  107.  
  108. procedure set_menu_color;
  109. begin
  110.   retrace;
  111.   for i:=1 to 6 do set_rgb_color(menucolor[i],37,0,0);
  112.   if highres=1 then set_rgb_color(kreuz[1],23,40,10)
  113.                else set_rgb_color(kreuz[1],0,0,32);
  114.   if overscan=1 then set_rgb_color(kreuz[2],23,40,10)
  115.                 else set_rgb_color(kreuz[2],0,0,32);
  116.   if music=1 then set_rgb_color(kreuz[3],23,40,10)
  117.              else set_rgb_color(kreuz[3],0,0,32);
  118.   for i:=1 to 6 do set_rgb_color(playercolor[i],20,0,0);
  119.   set_rgb_color(playercolor[player],37,0,0);
  120.   if auswahl = 5 then set_rgb_color(playercolor[player],23,40,10);
  121. end;
  122.  
  123. procedure load_mini(mininr:byte;fname:string);
  124. var f:file;
  125.     mfm:word;
  126. begin
  127.   mfm:=filemode;
  128.   filemode:=0;
  129.   assign(f,fname+'.MIN');
  130.   reset(f,1);
  131.   blockread(f,minis[mininr]^,filesize(f));
  132.   close(f);
  133.   filemode:=mfm;
  134. end;
  135.  
  136. procedure init_alles;
  137. begin
  138.  
  139.   getmem(minis[1],82*151);
  140.   getmem(minis[2],82*151);
  141.   miniseg[1]:=seg(minis[1]^);
  142.   miniseg[2]:=seg(minis[2]^);
  143.   load_mini(1,'MENU\MENU1');
  144.   load_mini(2,'MENU\MENU2');
  145.   ende:=false;
  146.   video_mode($13);
  147.   palette_black;
  148.   load_palette('MENU\menu1');
  149.   load_mini_palette('MENU\menu2');
  150.   set_rgb_color(rahmen1,0,0,0);
  151.   set_rgb_color(rahmen2,0,0,0);
  152.   set_rgb_color(kreuz[1],0,0,32);
  153.   set_rgb_color(kreuz[2],63,63,0);
  154.   set_rgb_color(kreuz[3],63,63,0);
  155.   SET_PAL0;
  156.   load_vga('MENU\menu1');
  157.   auswahl:=1;
  158.   params:=paramstr(2);
  159.   decode_paras;
  160. {  tables:=0;
  161.   highres:=0;
  162.   music:=1;
  163.   player:=1;
  164.   overscan:=1;}
  165.   auswahl:=1;
  166.   params:=paramstr(2);
  167.   decode_paras;
  168.   set_menu_color;
  169.   set_rgb_color(menucolor[auswahl],0,60,0);
  170.   PutSprite(212,24,150,82,miniseg[tables]);
  171. end;
  172.  
  173. procedure starte_flipper;
  174. var paras:string;
  175. begin
  176.   for i:=1 to 2 do FreeMem(minis[i], 82*151);
  177.   video_mode(3);
  178.  
  179.   i:=0;
  180.   if tables  = 2 then i:=i or 64;
  181.   if music   = 1 then i:=i or 32;
  182.   if highres = 1 then i:=i or 16;
  183.   if overscan= 1 then I:=i or  8;
  184.   i:=I or player;
  185.   halt(i);
  186. end;
  187.  
  188. procedure display_help;
  189. var ch:char;
  190. begin
  191.   video_mode($13);
  192.   palette_black;
  193.   load_palette('MENU\MENU3');
  194.   load_vga('MENU\MENU3');
  195.   repeat until keypressed;
  196.   while keypressed do ch:=readkey;
  197.   video_mode($13);
  198.   palette_black;
  199.   load_palette('MENU\menu1');
  200.   load_mini_palette('MENU\MENU2');
  201.   set_menu_color;
  202.   set_rgb_color(menucolor[auswahl],0,60,0);
  203.   SET_PAL0;
  204.   load_vga('MENU\MENU1');
  205.   i:=24;
  206.   Scroll(212,24,212,27,i-24,82);
  207.   putSprite(212,i,174-i,82,miniseg[tables]);
  208.  
  209. end;
  210.  
  211. begin
  212.   CheckBreak := False;
  213.   path:=paramstr(0);
  214.   hilfsb:=0;
  215.   while pos('\',copy(path,length(path)-hilfsb,1))=0 do inc(hilfsb);
  216.   path:=(copy(path,1,length(path)-hilfsb-1));
  217.   chDir(path);
  218.   if (paramcount <> 2) or (paramstr(1) <> 'START') then
  219.   begin halt(0); end;
  220.  
  221.   init_alles;
  222.   repeat
  223.     repeat
  224.       set_menu_color;
  225.       set_rgb_color(menucolor[auswahl],23,40,10);
  226.       repeat until keypressed;
  227.       ch:=ord(readkey);
  228.       if ch=0 then begin
  229.         ch:=ord(readkey);
  230.         if ch=59 then display_help;
  231.         if ch=80 then if auswahl<6 then inc(auswahl) else auswahl:=1;
  232.         if ch=72 then if auswahl>1 then dec(auswahl) else auswahl:=6;
  233.       end;
  234.       if ch=27 then ende:=true;
  235.     until (ch=13) or (ch=32) or (ende);
  236.     if not ende then
  237.     begin
  238.       if auswahl=1 then
  239.       begin
  240.         tables:=tables xor 3;
  241.         for i:=174 downto 24 do
  242.         begin
  243.           retrace;
  244.           Scroll(212,24,212,27,i-24,82);
  245.           putSprite(212,i,174-i,82,miniseg[tables]);
  246.           dec(i,4);
  247.           if i<24 then i:=24;
  248.         end;
  249.       end;
  250.       if auswahl=2 then highres:=highres xor 1;
  251.       if auswahl=3 then overscan:=overscan xor 1;
  252.       if auswahl=4 then music:=music xor 1;
  253.       if auswahl=5 then if player<6 then inc(player) else player:=1;
  254.       if auswahl=6 then starte_flipper;
  255.     end;
  256.   until ende;
  257.   go_out_of_here;
  258.   halt(128);
  259. end.
  260.  
  261.  
  262.